package com.kevin.concurrent;

/**
 * 测试interrupt
 * interrupt 中断一个线程
 *
 *
 * @author Kevin Liu
 * @date 2020/10/1 9:27 下午
 */
public class Fourth {

    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            for (;;) {
                ;
            }
        });
        thread.start();
        thread.interrupt();
        //true
        System.out.println(thread.isInterrupted());
        //false
        System.out.println(thread.interrupted());
        //false
        System.out.println(Thread.currentThread().isInterrupted());
        //true
        System.out.println(thread.isInterrupted());

    }
}
